<template>
	<globalModal title="设置信道" :visible="visible" :width="400" :bodyStyle="bodyStyle" :closable="false"
		:confirmLoading="confirmLoading" @ok="handleOk" @cancel="handleCancel">
		<a-spin :spinning="confirmLoading">
			<a-form :form="form" autocomplete="off" :labelCol="labelCol" :wrapperCol="wrapperCol" :hideRequiredMark="true">
				<a-form-item label=" " :colon="false">
					<a-input placeholder="请输入信道值1-6" v-decorator="[
							'receiverId',
							{
								rules: [
									{
										required:true,
										message: '请输入信道值'
									},
									{
										
										pattern: /^[1-6]$/,
										message: '请输入信道值1-6'
									}
								],
								trigger: 'blur'
							}
						]" />
				</a-form-item>
			</a-form>
		</a-spin>
	</globalModal>
</template>

<script>
	import {
		ModalMixins
	} from '@/mixins';
	import {
		PhoneReg
	} from '@/utils/validate.js';
	export default {
		name: 'addOrEditSignalpathModal',
		mixins: [ModalMixins],
		data() {
			return {
				bodyStyle: {
					maxHeight: '450px',
					minHeight: '100px',
					overflow: 'auto'
				},
				labelCol: {
					xs: {
						span: 24
					},
					sm: {
						span: 2
					}
				},
				wrapperCol: {
					xs: {
						span: 24
					},
					sm: {
						span: 20
					}
				},
				PhoneReg
			};
		},
		components: {},
		methods: {
			show(record) {
				this.visible = true;
			},
			handleOk() {
				const _this = this;
				// 触发表单验证
				this.form.validateFields((err, values) => {
					// 验证表单没错误
					if (!err) {
						/* 处理地址 */
						let parameter = {

						};
						_this.confirmLoading = true;
						this.$postAction(
								this.type == 'stu' ? sysManageapi.stuChangeDept : sysManageapi.usersChangeDept,
								Object.assign({}, {
										deptId: this.deptId
									},

								)
							)
							.then(res => {
								if (res && res.code == 200) {
									this.$message.success('保存成功');
									this.confirmLoading = false;
									this.$emit('ok');
									this.handleCancel();
								}
							})
							.finally(() => {
								this.confirmLoading = false;
							});
					}
				})
			},
			handleCancel() {
				this.$emit('close');
				this.visible = false;
			},
		}
	};
</script>

<style scoped></style>
